// 人员管理
import axios from "@/request/axios";

// 添加用户
export function userAdd(params: any) {
  return axios({
    url: "/system/user/add",
    method: "post",
    data: params,
  });
}

// 校验登录名
export function userCheckName(name: any) {
  return axios({
    url: "/system/user/checkName",
    method: "post",
    data: { name },
  });
}

// 删除用户
export function userDel(ids: any) {
  return axios({
    url: "/system/user/del",
    method: "post",
    data: ids,
  });
}

// 修改用户
export function userEdit(params: any) {
  return axios({
    url: "/system/user/edit",
    method: "post",
    data: params,
  });
}

// 所有用户列表
export function userGetAll() {
  return axios({
    url: "/system/user/getAll",
    method: "post",
  });
}

// 根据角色名获取用户
export function getByRoleName(roleName: any) {
  return axios({
    url: "/system/user/getByRoleName",
    method: "post",
    data: { roleName },
  });
}

// 查看用户信息
export function getUserById(id: any) {
  return axios({
    url: "/system/user/detail",
    method: "post",
    data: { id },
  });
}

// 重置密码
export function userInitPassword(id: any) {
  return axios({
    url: "/system/user/initPassword",
    method: "post",
    data: { id },
  });
}

// 查询用户列表
export function userQuery(params: any) {
  return axios({
    url: "/system/user/query",
    method: "post",
    data: params,
  });
}

// 查询用户列表
export function exportUser(params: any) {
  return axios({
    url: "/system/user/export",
    method: "post",
    responseType: 'blob',
    data: params,
  });
}